
		<div class="alert alert-warning alert-dismissible hide" role="alert"></div>
		
		<form class="form-horizontal ajax-form" method="post" action="{{urlfor "EnvController.Edit"}}">
			<input type="hidden" name="id" value="{{.env.Id}}" />
			
			<div class="form-group">
				<label for="name" class="col-sm-2 control-label">发布环境名称</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="name" name="name" value="{{.env.Name}}">
				</div>
			</div>
			
			<div class="form-group">
				<label for="ssh_user" class="col-sm-2 control-label">SSH帐号</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="ssh_user" name="ssh_user" value="{{.env.SshUser}}">
				</div>
			</div>
			<div class="form-group">
				<label for="ssh_port" class="col-sm-2 control-label">SSH端口</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="ssh_port" name="ssh_port" value="{{.env.SshPort}}">
				</div>
			</div>
			<div class="form-group">
				<label for="ssh_key" class="col-sm-2 control-label">SSH KEY路径</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="ssh_key" name="ssh_key" value="{{.env.SshKey}}">
				</div>
				<div class="help-block col-sm-8 col-sm-reset inline">密钥在跳板机存放的路径</div>
			</div>
			
			<div class="form-group">
				<label for="pub_dir" class="col-sm-2 control-label">发布目录</label>
				<div class="col-sm-3">
					<input type="text" class="form-control" id="pub_dir" name="pub_dir" value="{{.env.PubDir}}">
				</div>
				<div class="help-block col-sm-8 col-sm-reset inline">代码发布目标路径</div>
			</div>
			
			<div class="form-group">
				<label for="before_shell" class="col-sm-2 control-label">发布前执行的shell脚本</label>
				<div class="col-sm-6">
					<textarea name="before_shell" id="before_shell" rows="6" class="form-control" placeholder="发布前在目标服务器执行">{{.env.BeforeShell}}</textarea>
				</div>
			</div>
			
			<div class="form-group">
				<label for="after_shell" class="col-sm-2 control-label">发布后执行的shell脚本</label>
				<div class="col-sm-6">
					<textarea name="after_shell" id="after_shell" rows="6" class="form-control" placeholder="发布后在目标服务器执行">{{.env.AfterShell}}</textarea>
				</div>
			</div>
			
			<div class="form-group">
				<label for="after_shell" class="col-sm-2 control-label">服务器</label>
				<div class="col-sm-6">
					{{range $k,$v := .serverList}}
					<label class="inline">
						<input type="checkbox" id="server-{{$v.Id}}" class="ace ace-checkbox-2" name="serverIds" value="{{$v.Id}}">
						<span class="lbl"> {{$v.Ip}}</span>
					</label>
					&nbsp;&nbsp;
					{{end}}
				</div>
			</div>
			
			<div class="hr hr-16 hr-dotted"></div>
			
			<div class="form-group">
				<label for="send_mail" class="col-sm-2 control-label">是否发送邮件</label>
				<div class="col-sm-5">
					<input name="send_mail" class="ace ace-switch ace-switch-4 btn-flat" type="checkbox" value="1" {{if gt .env.SendMail 0}}checked{{end}}>
					<span class="lbl"></span>
				</div>
			</div>
			<div class="form-group">
				<label for="mail_to" class="col-sm-2 control-label">邮件模板</label>
				<div class="col-sm-6">
					<select name="mail_tpl_id">
						<option value="">请选择</option>
						{{range $k, $v := .mailTplList}}
						<option value="{{$v.Id}}" {{if eq $.env.MailTplId $v.Id}}selected{{end}}>{{$v.Name}}</option>
						{{end}}
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="mail_to" class="col-sm-2 control-label">收件人列表</label>
				<div class="col-sm-6">
					<textarea name="mail_to" id="mail_to" rows="4" class="form-control" placeholder="每行一个邮件地址">{{.env.MailTo}}</textarea>
				</div>
			</div>
			<div class="form-group">
				<label for="mail_cc" class="col-sm-2 control-label">抄送人列表</label>
				<div class="col-sm-6">
					<textarea name="mail_cc" id="mail_cc" rows="4" class="form-control" placeholder="每行一个邮件地址">{{.env.MailCc}}</textarea>
				</div>
			</div>

			<div class="clearfix form-actions">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-info"><i class="ace-icon fa fa-check bigger-110"></i>提交</button>
					<a href="{{urlfor "EnvController.List" "project_id" .env.ProjectId}}" class="btn btn-default"><i class="ace-icon fa fa-reply bigger-110"></i>返回</a>
				</div>
			</div>
		</form>

<script>
$(function() {
	var serverIds = eval({{.serverIds}});
	for (var k in serverIds) {
		$('#server-'+serverIds[k]).attr('checked', true);
	}
});
</script>